From 5e91d04c1b9dc8c08898b126b543f96e186b78ad Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 30 Oct 2021 08:14:11 -0600 Subject: [PATCH] workaround github cache output issues. (#749) a cache hit is reported only for an exact match. But in a pull request we can have an inexact match result in cache being fetched. --- .github/workflows/windows.yml | 15 ++++---------- tools/ci_install_windows.sh | 39 +++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0299a6ee1..1f507a8eb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -53,7 +53,7 @@ jobs: ARCH: 'amd64' HOST_ARCH: 'amd64' COMPILER: 'msvc2019_64' - AQTARCH: 'win64_msvc2019_64' + METHOD: 'aqt' RELEASE: false FLOW: 'nmake' @@ -69,25 +69,18 @@ jobs: key: ${{ runner.os }}-${{ matrix.QT_VERSION }}-${{ matrix.COMPILER }}-${{ secrets.CACHE_VERSION }} - name: Install Qt setup(aqt) - if: ${{ (steps.cache.outputs.cache-hit != 'true') && startsWith(matrix.QT_VERSION, '6') }} + if: steps.cache.outputs.cache-hit != 'true' uses: actions/setup-python@v2 with: python-version: '3.9' - - name: Install Qt(aqt) - if: ${{ (steps.cache.outputs.cache-hit != 'true') && startsWith(matrix.QT_VERSION, '6') }} - shell: bash - run: | - pip3 install aqtinstall>=2.0.0 - ./tools/ci_install_qt.sh windows ${{ matrix.QT_VERSION }} ${{ matrix.AQTARCH }} ${HOME}/Cache/Qt - - name: Install Qt - if: ${{ (steps.cache.outputs.cache-hit != 'true') && !startsWith(matrix.QT_VERSION, '6') }} + if: steps.cache.outputs.cache-hit != 'true' env: CI_BUILD_DIR: ${{ github.workspace }} shell: bash run: | - ./tools/ci_install_windows.sh ${{ matrix.QT_VERSION }} ${{ matrix.COMPILER }} + ./tools/ci_install_windows.sh ${{ matrix.QT_VERSION }} ${{ matrix.COMPILER }} ${{ matrix.METHOD }} - name: Build shell: powershell diff --git a/tools/ci_install_windows.sh b/tools/ci_install_windows.sh index 0a3c1655a..a14c99185 100755 --- a/tools/ci_install_windows.sh +++ b/tools/ci_install_windows.sh @@ -20,10 +20,14 @@ function validate() { QT_VERSION=${1:-5.12.10} COMPILER=${2:-msvc2017_64} +METHOD=${3:-default} + if [ "${COMPILER}" = "msvc2017_64" ]; then PACKAGE_SUFFIX=win64_msvc2017_64 elif [ "${COMPILER}" = "msvc2017" ]; then PACKAGE_SUFFIX=win32_msvc2017 +elif [ "${COMPILER}" = "msvc2019_64" ]; then + PACKAGE_SUFFIX=win64_msvc2019_64 else echo "ERROR: unrecognized Qt compiler ${COMPILER}." >&2 exit 1 @@ -36,18 +40,27 @@ if [ -d "${QTDIR}/bin" ]; then echo "Using cached Qt." else rm -fr "${CACHEDIR}" - QT_VERSION_SHORT=${QT_VERSION//./} - curl -s -L -o "qt-opensource-windows-x86-${QT_VERSION}.exe" "https://download.qt.io/official_releases/qt/5.12/${QT_VERSION}/qt-opensource-windows-x86-${QT_VERSION}.exe" - ls -l ./*.exe - netsh advfirewall firewall add rule name=dummyupqt dir=out action=block program="$(cygpath -w "${PWD}/qt-opensource-windows-x86-${QT_VERSION}.exe")" - "${PWD}/qt-opensource-windows-x86-${QT_VERSION}.exe" --verbose --script "${CI_BUILD_DIR}/tools/qtci/qt-install.qs" QTCI_OUTPUT="${CACHEDIR}/Qt" QTCI_PACKAGES="qt.qt5.${QT_VERSION_SHORT}.${PACKAGE_SUFFIX},qt.qt5.${QT_VERSION_SHORT}.qtwebengine" - netsh advfirewall firewall delete rule name=dummyupqt - rm "qt-opensource-windows-x86-${QT_VERSION}.exe" - ls "${CACHEDIR}/Qt" - rm -fr "${CACHEDIR}/Qt/Docs" - rm -fr "${CACHEDIR}/Qt/Examples" - rm -fr "${CACHEDIR}/Qt/Tools" - rm -f "${CACHEDIR}/Qt/MaintenanceTool.*" - echo "export PATH=${QTDIR}/bin:\$PATH" > "${CACHEDIR}/qt.env" + mkdir -p "${CACHEDIR}" + + if [ "${METHOD}" = "aqt" ]; then + pip3 install aqtinstall>=2.0.0 + "${CI_BUILD_DIR}/tools/ci_install_qt.sh" windows "${QT_VERSION}" "${PACKAGE_SUFFIX}" "${CACHEDIR}/Qt" + echo "export PATH=${QTDIR}/bin:\$PATH" > "${CACHEDIR}/qt.env" + else + QT_VERSION_SHORT=${QT_VERSION//./} + QT_VERSION_MAJMIN=${QT_VERSION%.*} + curl -s -L -o "qt-opensource-windows-x86-${QT_VERSION}.exe" "https://download.qt.io/official_releases/qt/${QT_VERSION_MAJMIN}/${QT_VERSION}/qt-opensource-windows-x86-${QT_VERSION}.exe" + ls -l ./*.exe + netsh advfirewall firewall add rule name=dummyupqt dir=out action=block program="$(cygpath -w "${PWD}/qt-opensource-windows-x86-${QT_VERSION}.exe")" + "${PWD}/qt-opensource-windows-x86-${QT_VERSION}.exe" --verbose --script "${CI_BUILD_DIR}/tools/qtci/qt-install.qs" QTCI_OUTPUT="${CACHEDIR}/Qt" QTCI_PACKAGES="qt.qt5.${QT_VERSION_SHORT}.${PACKAGE_SUFFIX},qt.qt5.${QT_VERSION_SHORT}.qtwebengine" + netsh advfirewall firewall delete rule name=dummyupqt + rm "qt-opensource-windows-x86-${QT_VERSION}.exe" + ls "${CACHEDIR}/Qt" + rm -fr "${CACHEDIR}/Qt/Docs" + rm -fr "${CACHEDIR}/Qt/Examples" + rm -fr "${CACHEDIR}/Qt/Tools" + rm -f "${CACHEDIR}/Qt/MaintenanceTool.*" + echo "export PATH=${QTDIR}/bin:\$PATH" > "${CACHEDIR}/qt.env" + fi fi validate -- 2.30.2